home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / X11 / InitialI.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-02-14  |  12.4 KB  |  430 lines

  1. /* $Xorg: InitialI.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */
  2.  
  3. /***********************************************************
  4.  
  5. Copyright 1987, 1988, 1994, 1998  The Open Group
  6.  
  7. Permission to use, copy, modify, distribute, and sell this software and its
  8. documentation for any purpose is hereby granted without fee, provided that
  9. the above copyright notice appear in all copies and that both that
  10. copyright notice and this permission notice appear in supporting
  11. documentation.
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of The Open Group shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from The Open Group.
  26.  
  27.  
  28. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
  29.  
  30.                         All Rights Reserved
  31.  
  32. Permission to use, copy, modify, and distribute this software and its 
  33. documentation for any purpose and without fee is hereby granted, 
  34. provided that the above copyright notice appear in all copies and that
  35. both that copyright notice and this permission notice appear in 
  36. supporting documentation, and that the name of Digital not be
  37. used in advertising or publicity pertaining to distribution of the
  38. software without specific, written prior permission.  
  39.  
  40. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  41. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  42. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  43. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  44. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  45. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  46. SOFTWARE.
  47.  
  48. ******************************************************************/
  49. /* $XFree86: xc/lib/Xt/InitialI.h,v 3.10 2001/12/14 19:56:18 dawes Exp $ */
  50.  
  51. #ifndef _XtinitialI_h
  52. #define _XtinitialI_h
  53.  
  54. /****************************************************************
  55.  *
  56.  * Displays
  57.  *
  58.  ****************************************************************/
  59.  
  60. #ifndef X_NOT_POSIX
  61. #ifdef _POSIX_SOURCE
  62. #include <limits.h>
  63. #else
  64. #define _POSIX_SOURCE
  65. #include <limits.h>
  66. #undef _POSIX_SOURCE
  67. #endif
  68. #endif
  69. #ifndef PATH_MAX
  70. #ifdef WIN32
  71. #define PATH_MAX 512
  72. #else
  73. #include <sys/param.h>
  74. #endif
  75. #ifndef PATH_MAX
  76. #ifdef MAXPATHLEN
  77. #define PATH_MAX MAXPATHLEN
  78. #else
  79. #define PATH_MAX 1024
  80. #endif
  81. #endif
  82. #endif
  83.  
  84. #include <X11/Xos.h>
  85. #include <X11/Xpoll.h>
  86.  
  87. typedef struct _TimerEventRec {
  88.         struct timeval        te_timer_value;
  89.     struct _TimerEventRec *te_next;
  90.     XtTimerCallbackProc   te_proc;
  91.     XtAppContext          app;
  92.     XtPointer          te_closure;
  93. } TimerEventRec;
  94.  
  95. typedef struct _InputEvent {
  96.     XtInputCallbackProc   ie_proc;
  97.     XtPointer          ie_closure;
  98.     struct _InputEvent    *ie_next;
  99.     struct _InputEvent    *ie_oq;
  100.     XtAppContext          app;
  101.     int              ie_source;
  102.     XtInputMask          ie_condition;
  103. } InputEvent;
  104.  
  105. typedef struct _SignalEventRec {
  106.     XtSignalCallbackProc  se_proc;
  107.     XtPointer          se_closure;
  108.     struct _SignalEventRec *se_next;
  109.     XtAppContext          app;
  110.     Boolean              se_notice;
  111. } SignalEventRec;
  112.  
  113. typedef struct _WorkProcRec {
  114.     XtWorkProc proc;
  115.     XtPointer closure;
  116.     struct _WorkProcRec *next;
  117.     XtAppContext app;
  118. } WorkProcRec;
  119.  
  120.  
  121. typedef struct 
  122. {
  123. #ifndef USE_POLL
  124.       fd_set rmask;
  125.     fd_set wmask;
  126.     fd_set emask;
  127. #endif
  128.     int    nfds;
  129. } FdStruct;
  130.  
  131. typedef struct _LangProcRec {
  132.     XtLanguageProc    proc;
  133.     XtPointer        closure;
  134. } LangProcRec;
  135.  
  136. typedef struct _ProcessContextRec {
  137.     XtAppContext    defaultAppContext;
  138.     XtAppContext    appContextList;
  139.     ConverterTable    globalConverterTable;
  140.     LangProcRec        globalLangProcRec;
  141. } ProcessContextRec, *ProcessContext;
  142.  
  143. typedef struct {
  144.     char*    start;
  145.     char*    current;
  146.     int        bytes_remaining;
  147. } Heap;
  148.  
  149. typedef struct _DestroyRec DestroyRec;
  150.  
  151.  
  152. typedef struct _XtAppStruct {
  153.     XtAppContext next;        /* link to next app in process context */
  154.     ProcessContext process;    /* back pointer to our process context */
  155.     InternalCallbackList destroy_callbacks;
  156.     Display **list;
  157.     TimerEventRec *timerQueue;
  158.     WorkProcRec *workQueue;
  159.     InputEvent **input_list;
  160.     InputEvent *outstandingQueue;
  161.     SignalEventRec *signalQueue;
  162.     XrmDatabase errorDB;
  163.     XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
  164.     XtErrorHandler errorHandler, warningHandler;
  165.     struct _ActionListRec *action_table;
  166.     ConverterTable converterTable;
  167.     unsigned long selectionTimeout;
  168.     FdStruct fds;
  169.     short count;            /* num of assigned entries in list */
  170.     short max;                /* allocate size of list */
  171.     short last;
  172.     short input_count;
  173.     short input_max;            /* elts input_list init'd with */
  174.     Boolean sync, being_destroyed, error_inited;
  175. #ifndef NO_IDENTIFY_WINDOWS
  176.     Boolean identify_windows;        /* debugging hack */
  177. #endif
  178.     Heap heap;
  179.     String * fallback_resources;    /* Set by XtAppSetFallbackResources. */
  180.     struct _ActionHookRec* action_hook_list;
  181.     struct _BlockHookRec* block_hook_list;
  182.     int destroy_list_size;        /* state data for 2-phase destroy */
  183.     int destroy_count;
  184.     int dispatch_level;
  185.     DestroyRec* destroy_list;
  186.     Widget in_phase2_destroy;
  187.     LangProcRec langProcRec;
  188.     struct _TMBindCacheRec * free_bindings;
  189.     String display_name_tried;
  190.     Display **dpy_destroy_list;
  191.     int dpy_destroy_count;
  192.     Boolean exit_flag;
  193.     Boolean rebuild_fdlist;
  194. #ifdef XTHREADS
  195.     LockPtr lock_info;
  196.     ThreadAppProc lock;
  197.     ThreadAppProc unlock;
  198.     ThreadAppYieldLockProc yield_lock;
  199.     ThreadAppRestoreLockProc restore_lock;
  200.     ThreadAppProc free_lock;
  201. #endif
  202. } XtAppStruct;
  203.  
  204. extern void _XtHeapInit(Heap* heap);
  205. extern void _XtHeapFree(Heap* heap);
  206.  
  207. #ifdef XTTRACEMEMORY
  208.  
  209.  
  210. extern char *_XtHeapMalloc(
  211.     Heap*    /* heap */,
  212.     Cardinal    /* size */,
  213.     char *    /* file */,
  214.     int        /* line */
  215. );
  216.  
  217. #define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
  218.  
  219. #else /* XTTRACEMEMORY */
  220.  
  221. extern char* _XtHeapAlloc(
  222.     Heap*    /* heap */,
  223.     Cardinal    /* size */
  224. );
  225.  
  226. #endif /* XTTRACEMEMORY */
  227.  
  228. extern void _XtSetDefaultErrorHandlers(
  229.     XtErrorMsgHandler*    /* errMsg */,
  230.     XtErrorMsgHandler*    /* warnMsg */,
  231.     XtErrorHandler*    /* err */,
  232.     XtErrorHandler*    /* warn */
  233. );
  234.  
  235. extern void _XtSetDefaultSelectionTimeout(
  236.     unsigned long* /* timeout */
  237. );
  238.  
  239. extern XtAppContext _XtDefaultAppContext(
  240.     void
  241. );
  242.  
  243. extern ProcessContext _XtGetProcessContext(
  244.     void
  245. );
  246.  
  247. Display *
  248. _XtAppInit(
  249.     XtAppContext*    /* app_context_return */,
  250.     String        /* application_class */,
  251.     XrmOptionDescRec*    /* options */,
  252.     Cardinal        /* num_options */,
  253.     int*        /* argc_in_out */,
  254.     String**        /* argv_in_out */,
  255.     String*        /* fallback_resources */
  256. );
  257.  
  258. extern void _XtDestroyAppContexts(
  259.     void
  260. );
  261.  
  262. extern void _XtCloseDisplays(
  263.     XtAppContext    /* app */
  264. );
  265.  
  266. extern int _XtAppDestroyCount;
  267.  
  268. extern int _XtWaitForSomething(
  269.     XtAppContext    /* app */,
  270.     _XtBoolean         /* ignoreEvents */,
  271.     _XtBoolean         /* ignoreTimers */,
  272.     _XtBoolean         /* ignoreInputs */,
  273.     _XtBoolean        /* ignoreSignals */,
  274.     _XtBoolean         /* block */,
  275. #ifdef XTHREADS
  276.     _XtBoolean        /* drop_lock */,
  277. #endif
  278.     unsigned long*    /* howlong */
  279. );
  280.  
  281. typedef struct _CaseConverterRec *CaseConverterPtr;
  282. typedef struct _CaseConverterRec {
  283.     KeySym        start;        /* first KeySym valid in converter */
  284.     KeySym        stop;        /* last KeySym valid in converter */
  285.     XtCaseProc        proc;        /* case converter function */
  286.     CaseConverterPtr    next;        /* next converter record */
  287. } CaseConverterRec;
  288.  
  289. typedef struct _ExtensionSelectorRec {
  290.     XtExtensionSelectProc proc;
  291.     int min, max;
  292.     XtPointer client_data;
  293. } ExtSelectRec;
  294.  
  295. typedef struct _XtPerDisplayStruct {
  296.     InternalCallbackList destroy_callbacks;
  297.     Region region;
  298.     CaseConverterPtr case_cvt;        /* user-registered case converters */
  299.     XtKeyProc defaultKeycodeTranslator;
  300.     XtAppContext appContext;
  301.     unsigned long keysyms_serial;      /* for tracking MappingNotify events */
  302.     KeySym *keysyms;                   /* keycode to keysym table */
  303.     int keysyms_per_keycode;           /* number of keysyms for each keycode*/
  304.     int min_keycode, max_keycode;      /* range of keycodes */
  305.     KeySym *modKeysyms;                /* keysym values for modToKeysysm */
  306.     ModToKeysymTable *modsToKeysyms;   /* modifiers to Keysysms index table*/
  307.     unsigned char isModifier[32];      /* key-is-modifier-p bit table */
  308.     KeySym lock_meaning;           /* Lock modifier meaning */
  309.     Modifiers mode_switch;           /* keyboard group modifiers */
  310.     Modifiers num_lock;               /* keyboard numlock modifiers */
  311.     Boolean being_destroyed;
  312.     Boolean rv;                   /* reverse_video resource */
  313.     XrmName name;               /* resolved app name */
  314.     XrmClass class;               /* application class */
  315.     Heap heap;
  316.     struct _GCrec *GClist;           /* support for XtGetGC */
  317.     Drawable **pixmap_tab;             /* ditto for XtGetGC */
  318.     String language;               /* XPG language string */
  319.     XEvent last_event;               /* last event dispatched */
  320.     Time last_timestamp;           /* from last event dispatched */
  321.     int multi_click_time;           /* for XtSetMultiClickTime */
  322.     struct _TMKeyContextRec* tm_context;     /* for XtGetActionKeysym */
  323.     InternalCallbackList mapping_callbacks;  /* special case for TM */
  324.     XtPerDisplayInputRec pdi;           /* state for modal grabs & kbd focus */
  325.     struct _WWTable *WWtable;           /* window to widget table */
  326.     XrmDatabase *per_screen_db;        /* per screen resource databases */
  327.     XrmDatabase cmd_db;               /* db from command line, if needed */
  328.     XrmDatabase server_db;           /* resource property else .Xdefaults */
  329.     XtEventDispatchProc* dispatcher_list;
  330.     ExtSelectRec* ext_select_list;
  331.     int ext_select_count;
  332.     Widget hook_object;
  333. #ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
  334.     Atom rcm_init;            /* ResConfig - initialize */
  335.     Atom rcm_data;            /* ResConfig - data atom */
  336. #endif
  337. } XtPerDisplayStruct, *XtPerDisplay;
  338.  
  339. typedef struct _PerDisplayTable {
  340.     Display *dpy;
  341.     XtPerDisplayStruct perDpy;
  342.     struct _PerDisplayTable *next;
  343. } PerDisplayTable, *PerDisplayTablePtr;
  344.  
  345. extern PerDisplayTablePtr _XtperDisplayList;
  346.  
  347. extern XtPerDisplay _XtSortPerDisplayList(
  348.     Display* /* dpy */
  349. );
  350.  
  351. extern XtPerDisplay _XtGetPerDisplay(
  352.     Display*        /* dpy */
  353. );
  354.  
  355. extern XtPerDisplayInputRec* _XtGetPerDisplayInput(
  356.     Display*         /* dpy */
  357. );
  358.  
  359. #if 0
  360. #ifdef DEBUG
  361. #define _XtGetPerDisplay(display) \
  362.     ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
  363.      ? &_XtperDisplayList->perDpy \
  364.      : _XtSortPerDisplayList(display))
  365. #define _XtGetPerDisplayInput(display) \
  366.     ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
  367.      ? &_XtperDisplayList->perDpy.pdi \
  368.      : &_XtSortPerDisplayList(display)->pdi)
  369. #else
  370. #define _XtGetPerDisplay(display) \
  371.     ((_XtperDisplayList->dpy == (display)) \
  372.      ? &_XtperDisplayList->perDpy \
  373.      : _XtSortPerDisplayList(display))
  374. #define _XtGetPerDisplayInput(display) \
  375.     ((_XtperDisplayList->dpy == (display)) \
  376.      ? &_XtperDisplayList->perDpy.pdi \
  377.      : &_XtSortPerDisplayList(display)->pdi)
  378. #endif /*DEBUG*/
  379. #endif
  380.  
  381. extern void _XtDisplayInitialize(
  382.     Display*        /* dpy */,
  383.     XtPerDisplay    /* pd */,
  384.     _Xconst char*    /* name */,
  385.     XrmOptionDescRec*    /* urlist */,
  386.     Cardinal         /* num_urs */,
  387.     int*        /* argc */,
  388.     char**         /* argv */
  389. );
  390.  
  391. extern void _XtCacheFlushTag(
  392.     XtAppContext /* app */,
  393.     XtPointer     /* tag */
  394. );
  395.  
  396. extern void _XtFreeActions(
  397.     struct _ActionListRec* /* action_table */
  398. );
  399.  
  400. extern void _XtDoPhase2Destroy(
  401.     XtAppContext /* app */,
  402.     int         /* dispatch_level */
  403. );
  404.  
  405. extern void _XtDoFreeBindings(
  406.     XtAppContext /* app */
  407. );
  408.  
  409. extern void _XtExtensionSelect(
  410.     Widget /* widget */
  411. );
  412.  
  413. #define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
  414.  
  415. extern void _XtAllocWWTable(
  416.     XtPerDisplay pd
  417. );
  418.  
  419. extern void _XtFreeWWTable(
  420.     XtPerDisplay pd
  421. );
  422.  
  423. extern String _XtGetUserName(String dest, int len);
  424. extern XrmDatabase _XtPreparseCommandLine(XrmOptionDescRec *urlist,
  425.             Cardinal num_urs, int argc, String *argv,
  426.             String *applName, String *displayName,
  427.             String *language);
  428.  
  429. #endif /* _XtinitialI_h */
  430.